<div class="layui-container fly-marginTop">
    <div class="fly-panel fly-panel-user" pad20>
        <div class="layui-tab layui-tab-brief" lay-filter="user">
            <ul class="layui-tab-title">
                <li><a href="{:url('home/index/login')}">登入</a></li>
                <li><a href="{:url('home/index/register')}">注册</a></li>
                <li class="layui-this">找回密码</li>
            </ul>
            <div class="layui-form layui-tab-content" id="LAY_ucm" style="padding: 20px 0;">
                <div class="layui-tab-item layui-show">
                    <div class="layui-form layui-form-pane">
                        <form method="post">
                            <!-- 邮箱 -->
                            <div class="layui-form-item">
                                <label for="email" class="layui-form-label">邮箱</label>
                                <div class="layui-input-inline">
                                    <input type="text" id="email" name="email" required placeholder="请输入邮箱地址"
                                        class="layui-input">
                                </div>
                                <!-- 找回密码 -->
                                <div class="layui-form-mid layui-word-aux">
                                    找回密码
                                    <a id="retr" href="javascript:void(0)"
                                        style="font-size: 12px; color: #4f99cf;">点击邮箱找回密码</a>
                                </div>
                            </div>

                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>

</div>
<script>
    layui.use(['form', 'jquery'], function () {
        var $ = layui.jquery

        //找回密码邮件发送
        $("#retr").click(function () {
            var email = $("#email").val().trim()
            //确认对话框
            layer.confirm(`是否发送邮件找回密码：${email}`, { icon: 3, title: '提示' }, function (index) {
                //关闭弹框
                layer.close(index)

                //发送异步的ajax请求
                $.ajax({
                    url: `{:url('home/index/retr')}`,
                    type: 'post',
                     data: { email: email },
                    dataType: 'json',
                    success: function (success) {
                        layer.msg(success.msg)
                    }
                })
            })
        })
    })
</script>